<?php
/**
 * Created by PhpStorm.
 * User: hanbin
 * Date: 17/5/30
 * Time: 下午9:29
 */

namespace App\Logic\zhihu;


use App\Logic\BaseLogic;
use App\Server\zhihu\ServiceModel;

/**
 * 服务
 */
class ServiceLogic extends BaseLogic
{

    /**
     * 服务列表
     */
    public static function getList()
    {
        $detail = ServiceModel::getList(10, null, 1, ['status' => 1]);
        $result = [];
        foreach ($detail['data'] as $k => $v) {
            $item = $v;
            unset($item['service_type']);
            unset($item['type']);
            unset($item['update_time']);
            $result[] = $item;
        }
        return self::success($result, 200, 'ok');
    }

    /**
     * 服务详情
     * @param int $id
     * @return array
     */
    public static function detail($id = 0)
    {
        $detail = ServiceModel::first(['id' => $id]);
        unset($detail['type']);
        unset($detail['service_type']);
        unset($detail['update_time']);
        return self::success($detail, 200, 'ok');
    }

}